package com.xgj.dto;

import java.util.List;

/**
 * 数据导入结果对象
 * 用于封装全量导入操作的详细结果。
 */
public class ImportResult {

    private int total;                     // 总数据条数
    private int success;                   // 成功条数
    private int failed;                    // 失败条数
    private List<FailedRecord> failedRecords; // 失败记录详情

    // ------------------------- 失败记录详情 -------------------------
    public static class FailedRecord {
        private int index;          // 数据索引（如第几条数据）
        private String rawData;     // 原始数据（脱敏后的 JSON 或字符串）
        private int errorCode;      // 错误类型（使用整数错误码）
        private String errorMsg;    // 用户友好错误提示（如“邮箱格式无效”）
        private String errorDetail; // 详细错误信息（开发者调试用）

        // 构造方法、Getter/Setter...
        public FailedRecord(int index, String rawData, int errorCode, String errorMsg, String errorDetail) {
            this.index = index;
            this.rawData = rawData;
            this.errorCode = errorCode;
            this.errorMsg = errorMsg;
            this.errorDetail = errorDetail;
        }

        // Getter/Setter...
        public int getErrorCode() {
            return errorCode;
        }

        public void setErrorCode(int errorCode) {
            this.errorCode = errorCode;
        }

        public int getIndex() {
            return index;
        }

        public void setIndex(int index) {
            this.index = index;
        }

        public String getRawData() {
            return rawData;
        }

        public void setRawData(String rawData) {
            this.rawData = rawData;
        }

        public String getErrorMsg() {
            return errorMsg;
        }

        public void setErrorMsg(String errorMsg) {
            this.errorMsg = errorMsg;
        }

        public String getErrorDetail() {
            return errorDetail;
        }

        public void setErrorDetail(String errorDetail) {
            this.errorDetail = errorDetail;
        }
    }

    // ------------------------- 构造方法 -------------------------
    public ImportResult(int total, int success, int failed, List<FailedRecord> failedRecords) {
        this.total = total;
        this.success = success;
        this.failed = failed;
        this.failedRecords = failedRecords;
    }

    // ------------------------- Getter/Setter -------------------------
    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getSuccess() {
        return success;
    }

    public void setSuccess(int success) {
        this.success = success;
    }

    public int getFailed() {
        return failed;
    }

    public void setFailed(int failed) {
        this.failed = failed;
    }

    public List<FailedRecord> getFailedRecords() {
        return failedRecords;
    }

    public void setFailedRecords(List<FailedRecord> failedRecords) {
        this.failedRecords = failedRecords;
    }
}
